<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>“双随机”抽取结果</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var arrayObj = new Array();
		$(document).ready(function() {
			<c:forEach items="${list_xz}" var="drRwXz" varStatus="s">
			$(":checkbox[name=could_box_${s['index']+1}]").each(function(){
				$(this).click(function(){
					if($(this).attr('checked')){
						$(":checkbox[name=could_box_${s['index']+1}]").removeAttr('checked');
						$(this).attr('checked','checked');
						$("#id${s['index']+1}").val($(this).attr("id"));
						//alert($("#id${s['index']+1}").val());
						$('.error').remove();
					}else{ 
						$("#id${s['index']+1}").val("");
					}
				});
			});	
			</c:forEach> 	
			
			$("#inputForm").validate({
                rules: {
					<c:forEach items="${list_xz}" var="drRwXz" varStatus="s">
                    id${s['index']+1}: {required: true},
					</c:forEach>
                },
                messages: {
					<c:forEach items="${list_xz}" var="drRwXz" varStatus="s">
                    id${s['index']+1}: {required: "请选择小组组长"},
					</c:forEach>
                },				
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});				
			$("#btnBack").click(function(){
				$.jBox($("#backBox").html(), {title:"重新抽取", buttons:{"关闭":true}, 
					bottomText:""});
			});																							
		});
		function doSubmit(){ 
			$(":checkbox").each(function(){
				if($(this).is(':checked')){ 
					arrayObj.push($(this).attr("id"));
				}
			});	
			$('#zzs').val(arrayObj.join(","));
			$('#inputForm').submit();
		}

	</script>
</head>
<body>
	<div id="backBox" class="hide">
		<form id="backForm" name="backForm" modelAttribute="drRw" action="${ctx}/rw/drRw/doExtract" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;"><br/>
        	<input type="hidden" name="id" value="${drRw.id}"/>
            <div class="control-group">
                <label class="control-label" style="width:45px;">原因：</label>
                <div class="controls" style="margin-left:0px;margin-top:5px;">         	
                    <textarea id="remarks" name="remarks" htmlEscape="false" maxlength="255" rows="4" class="input-xlarge required"></textarea>
                    <span class="help-inline"><font color="red">*</font> </span>
                </div>
            </div>
            <br/><input id="btnImportSubmit" class="btn btn-primary" type="button" value="重新抽取" onClick="javascript:doReSelect()"/>
		</form>
        <script language="javascript">
		$(function(){ 
			$("#backForm").validate({
                rules: {
                    remarks: {required: true},
                },
                messages: {
                    remarks: {required: "请填写原因"},
                },									
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});			
		})
		function doReSelect(){
			var text = document.getElementById('remarks').innerHTML;
			var text1 = document.getElementById('remarks').text;
			var text2 = document.getElementById('remarks').value;
			//alert(text);
			//alert(text1);
			//alert(text2);
			//var obj = $('#remarks');
			//alert(obj);
			//alert($('#remarks').val());

				$('#backForm').submit();
			
		}		
		</script>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="">“双随机”随机抽取结果</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="drRw" action="" method="post" class="breadcrumb form-search">
		<ul class="ul-form">
			<li class="clearfix" style="text-align:right"><strong>${drRw.rwMc}</strong></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
    <form:form id="inputForm" modelAttribute="drRw" action="${ctx}/rw/drRw/saveZz" method="post" class="form-horizontal" >
    	<input type="hidden" name="zzs" id="zzs" value=""/>
    	<div class="control-group">
        	<div class="control-group" style="vertical-align:middle">
			<label class="control-label" style="text-align:center;"><strong>随机抽取执法人员</strong></label>
                <div class="controls">
                	<c:forEach items="${list_xz}" var="drRwXz" varStatus="s">
                    <table id="contentTable" class="table table-striped table-bordered table-condensed">
                        <thead>
                            <tr>
                            	<th>组长</th>
                                <th>姓名</th>
            <th>所属局</th>
            <th>所属机构</th>
            <th>所属科室</th>
            <th>性别</th>
            <th>专业/专业技能</th>
            <th>执法证号</th>
            <th>签证官类别</th>
            <th>现场查验岗位类别</th>
            <th>岗位</th>
            <th>职务</th>
            <th>工作年限</th>
            <th>已获得岗位资格</th>
            <th>电话</th>
            <th>手机</th>
                                <th>组别</th>
                            </tr>
                        </thead>
                        <tbody>
                        	<c:forEach items="${drRwXz.drRwXzyrList}" var="drRwXzyr">
                                <tr>
                                	<td width="8px"><input name="could_box_${s['index']+1}" type="checkbox" value="" id="${drRwXzyr.id}"/></td>
                                    <td>${drRwXzyr.user.name}</td>
                                    <td>${drRwXzyr.user.company.name}</td>
                                    <td>${drRwXzyr.user.office.name}</td>
                                    <td>${drRwXzyr.user.keshi.name}</td>
                                    <td>${fns:getDictLabel(drRwXzyr.user.sex, 'sex', '')}</td>
                                    <td>${drRwXzyr.user.zy}</td>
                                    <td>${drRwXzyr.user.zfzh}</td>
          							<td>${fns:getDictLabel(drRwXzyr.user.qzglb, 'user_dong_zhi', '')}</td>
          							<td>${fns:getDictLabel(drRwXzyr.user.xccygwlb, 'user_dong_zhi', '')}</td>                                    
                                    <td>${drRwXzyr.user.gw}</td>
                                    <td>${drRwXzyr.user.zw}</td>
                                    <td>${drRwXzyr.user.gznx}</td>
                                    <td>${drRwXzyr.user.gwzg}</td>
                                    <td>${drRwXzyr.user.phone}</td>
                                    <td>${drRwXzyr.user.mobile}</td>
                                    <td>${drRwXzyr.xzId.remarks}</td>
                                </tr>			
                        	</c:forEach>
                        </tbody>
                    </table>
                    <input type="input" id="id${s['index']+1}" name="id${s['index']+1}" value="" style="width:0px;height:0px;"/>   
                    <br/>
                    </c:forEach>                              
                </div>
            </div>    
        </div>
		<div class="control-group">
        	<div class="control-group" style="vertical-align:middle">
			<label class="control-label" style="text-align:center;"><strong>随机抽取执法对象</strong></label>
                <div class="controls">
                    <table id="contentTable" class="table table-striped table-bordered table-condensed">
                        <thead>
                              <c:forEach items="${list_title}" var="title">
                                <th>${title.dxTMc}</th>
                              </c:forEach>
                                <th>任务组</th>
                        </thead>
                        <tbody>
      <c:forEach items="${dxk}" var="dxk" varStatus="s">
        <c:if test="${fn:length(list_title)==0}"> </c:if>
        <c:if test="${fn:length(list_title)==1}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==2}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==3}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==4}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==5}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==6}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==7}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==8}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==9}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==10}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==11}">
          <tr>
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==12}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==13}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==14}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==15}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.col15}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==16}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.col15}</td>
            <td>${dxk.col16}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==17}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.col15}</td>
            <td>${dxk.col16}</td>
            <td>${dxk.col17}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==18}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.col15}</td>
            <td>${dxk.col16}</td>
            <td>${dxk.col17}</td>
            <td>${dxk.col18}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==19}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.col15}</td>
            <td>${dxk.col16}</td>
            <td>${dxk.col17}</td>
            <td>${dxk.col18}</td>
            <td>${dxk.col19}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
        <c:if test="${fn:length(list_title)==20}">
          <tr>
          	
            <td>${dxk.col1}</td>
            <td>${dxk.col2}</td>
            <td>${dxk.col3}</td>
            <td>${dxk.col4}</td>
            <td>${dxk.col5}</td>
            <td>${dxk.col6}</td>
            <td>${dxk.col7}</td>
            <td>${dxk.col8}</td>
            <td>${dxk.col9}</td>
            <td>${dxk.col10}</td>
            <td>${dxk.col11}</td>
            <td>${dxk.col12}</td>
            <td>${dxk.col13}</td>
            <td>${dxk.col14}</td>
            <td>${dxk.col15}</td>
            <td>${dxk.col16}</td>
            <td>${dxk.col17}</td>
            <td>${dxk.col18}</td>
            <td>${dxk.col19}</td>
            <td>${dxk.col20}</td>
            <td>${dxk.xzId.remarks}</td>
          </tr>
        </c:if>
      </c:forEach>
                        </tbody>
                    </table>            
                </div>
            </div>    
        </div>    
		<div class="form-actions">
			<shiro:hasPermission name="rw:drRw:edit"><input id="btnSubmit" class="btn btn-primary" type="button" value="确认结果" onClick="javascript:doSubmit();"/>&nbsp;</shiro:hasPermission>
			<input id="btnBack" class="btn btn-danger" type="button" value="重新抽取"/>
		</div>            
    </form:form>

</body>
</html>